<%@ include file="/WEB-INF/jsp/includes.jsp" %>
<%@ page contentType="text/html;charset=UTF-8" language="java" pageEncoding="UTF-8"  %>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
    <title>浙江孵化器在线后台管理系统---系统管理---邮件管理---已发邮件列表</title>
    <link href="<spring:url value="/static/style/index.css" htmlEscape="true" />" rel="stylesheet" type="text/css">
</head>
<body>
<div class="list_right_title">
    <span><img src="<spring:url value="/static/images/email_icon.jpg" htmlEscape="true" />" alt="邮件管理"></span>系统管理>>邮件管理>已发送邮件
</div>
<div class="step_mail_title">
			<ul>
				<li><a href="manageSendEmail">发送邮件</a></li>
				<li class="step_mail_title_select">已发邮件</li>
			</ul>
		</div>
<div class="list_right_table_title">
    <div class="list_right_table_title_form">
        <form:form method="post" action="listSuccessEmails" name="multiplyActionForm"
                   id="multiplyActionForm">      
            <input type="hidden" name="selectedSuccessEmailIDArray" id="selectedSuccessEmailIDArray"/>
            <input type="submit" value="  删除  " onclick="return checkSelectedSuccessEmails(this.form)"/>
        </form:form>
    </div>
    <%@ include file="/WEB-INF/jsp/management/common/pagebar.jsp" %>
</div>
<div class="table_box">
    <table class="table" cellspacing="0" cellpadding="0" summary="系统管理>>邮件管理>已发邮件列表">
        <tr>
            <th nowrap width="3%" align="center">
                <input type="checkbox" id="fatherControlCB" onclick='selectAll()'/>
            </th>
            <th  width="6%" >
                <img src="<spring:url value="/static/images/step_mail_title_icon.jpg" htmlEscape="true" />" alt="已发邮件">
            </th>
				<th width="12%">收件人</th>
				<th width="22%">主题</th>
				<th width="12%">发送时间</th>
        </tr>
        <c:forEach var="successEmail" items="${page.result}">
            <tr>
                <td align="center" nowrap><input name="successEmailIndex" type="checkbox" value="${successEmail.id}"/></td>
                <td>
                    <img src="<spring:url value="/static/images/step_mail_list_icon.jpg" htmlEscape="true" />" alt="已发邮件">
                </td>
                <td nowrap>${successEmail.acceptorEmail}</td>
                <td align="center" nowrap>${successEmail.topic}</td>
                <td align="center" nowrap><fmt:formatDate value="${successEmail.updateDatetime}" pattern="yyyy-MM-dd HH:mm:ss"/></td>
            </tr>
        </c:forEach>
    </table>
</div>
<div class="list_right_table_title">
    <div class="list_right_table_title_form">
        <form:form method="post" action="listSuccessEmails" name="multiplyActionForm2"
                   id="multiplyActionForm2">
            <input type="hidden" name="selectedSuccessEmailIDArray" id="selectedSuccessEmailIDArray2"/>
                <input type="submit" value="  删除  " onclick="return checkSelectedSuccessEmails(this.form)"/>
            </form:form>
        </div>
        <%@ include file="/WEB-INF/jsp/management/common/pagebar.jsp" %>
    </div>
    </body>
    <script type="text/javascript">
        function getSelectedSuccessEmails() {
            var allSelectedSuccessEmails = new Array();
            var allChkBoxes = document.getElementsByName("successEmailIndex");
            if (allChkBoxes != null)
                for (var i = 0,j = 0; i < allChkBoxes.length; i++) {
                    if (allChkBoxes[i].checked == true)
                        allSelectedSuccessEmails[j++] = allChkBoxes[i].value;
                }
            return  allSelectedSuccessEmails;
        }

        function checkSelectedSuccessEmails(formObj) {
            var selectedSuccessEmails = getSelectedSuccessEmails();
            if (selectedSuccessEmails == null || selectedSuccessEmails.length < 1) {
                alert("没有选中项！");
                return false;
            } else {
                var result = window.confirm("你确信要删除所有选中项么?")
                if (!result) {
                    return false
                }
                formObj.action = "deleteSuccessEmails";
                document.getElementById("selectedSuccessEmailIDArray").value = selectedSuccessEmails;
                document.getElementById("selectedSuccessEmailIDArray2").value = selectedSuccessEmails;
                return true;
            }
        }

    function selectAll() {
        var allChkBoxes = document.getElementsByName("successEmailIndex");
        if (document.getElementById("fatherControlCB").checked) {
            for (var i = 0,j = 0; i < allChkBoxes.length; i++) {
                if (allChkBoxes[i].checked == false) {
                    allChkBoxes[i].checked = true;
                }
            }
        }
        else {
            for (var i = 0,j = 0; i < allChkBoxes.length; i++) {
                if (allChkBoxes[i].checked == true) {
                    allChkBoxes[i].checked = false;
                }
            }
        }
    }
</script>

</html>